package com.terrynoya.fight.stateMachine.controllers
{
	import com.terrynoya.fight.char.Character;
	import com.terrynoya.fight.char.Entity;
	import com.terrynoya.fight.evaluation.Expression;
	import com.terrynoya.fight.stateMachine.StateController;
	import com.terrynoya.fight.stateMachine.StateMachine;
	import com.terrynoya.fight.stateMachine.controllers.attrParser.StateCtrlParserType;
	
	public class ChangeAni extends StateController
	{
		private var _elementId:int;

		private var _animationId:int;
		
		public function ChangeAni(name:String)
		{
			super(name);
		}
		
		override protected function initAttrConvertMap():void
		{
			this.attrConvertMap.put("value",StateCtrlParserType.Expression);
		}
		
		override public function run(character:Character):void
		{
			var exp:Expression = this.getExpression("value");
			this._animationId = exp.excute(character);
//			trace("run change ani:",this.animationId);
			character.setLocalAnimation(this.animationId,this.elementId);
		}

		public function get elementId():int
		{
			return _elementId;
		}

		public function set elementId(value:int):void
		{
			_elementId = value;
		}

		public function get animationId():int
		{
			return this._animationId;
		}

		public function set animationId(value:int):void
		{
			this._animationId = value;
		}

	}
}